<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>用户列表</title>
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/easyui.css">
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/icon.css">
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/neweasyui/themes/gray/panel.css">
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/neweasyui/themes/gray/window.css">
  <script type="text/javascript" src="<%=path %>/script/1.11.1.js"></script>
  <script type="text/javascript" src="<%=path %>/script/jquery.easyui.min.js"></script>
  <script type="text/javascript" src="<%=path %>/script/easyui-lang-zh_CN.js"></script>
  <script type="text/javascript" src="<%=path %>/script/dateFormat.js"></script>
  <script type="text/javascript" src="<%=path %>/script/datagrid-bufferview.js"></script>
  <script type="text/javascript" src="<%=path %>/script/common.js"></script>
  <style type="text/css">
    #fm{
      margin:0;
      padding:10px 30px;
    }
    .ftitle{
      font-size:14px;
      font-weight:bold;
      padding:5px 0;
      margin-bottom:10px;
      border-bottom:1px solid #ccc;
    }
    .fitem{
      margin-bottom:17px;
    }
    .fitem label{
      display:inline-block;
      width:80px;
    }
    .fitem input{
      width:230px;
    }
  </style>
</head>
<body>
<table id="tt" title="用户列表" style="width:auto;height:500px">
</table>
<div id="toolbar" style="padding:5px;height:auto">
  <div>
    <!-- 搜索条件结束 -->
   <!-- <a href="<%=basePath %>/activityManage/toAddActivity"  class="easyui-linkbutton" iconCls="icon-add">添加</a>&nbsp;
    <a href="javascript:void(0)"  class="easyui-linkbutton" iconCls="icon-edit" onclick="editActivity()">修改</a>&nbsp;
    <a href="javascript:void(0)"  class="easyui-linkbutton" iconCls="icon-remove" onclick="deleteActivity()">删除</a>&nbsp;&nbsp; --> 
    <input type="text" name="day" id="day" class="easyui-datebox"/>
	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" onclick="searchUser()">查询</a>
  </div>
</div>

</body>
<script type="text/javascript">
    
  $.ajaxSetup({cache:false});
  $(function(){
    $('#start_date').datetimebox({
      showSeconds:false,parser:w3

    });
    $('#end_date').datetimebox({
      showSeconds:false,parser:w3
    });
    $('#tt').datagrid({
      url:'<%=basePath %>service/class/sys/user?day=',
      method:'get',
      singleSelect:true,toolbar:'#toolbar',remoteSort:false,pageSize:50,nowrap:false,
      fitColumns:true,
      rownumbers: true,
      pagination:true,
      columns:[[
        {field:'id',title:'ID',sortable:true,width:15,hidden:true},
        {field:'name',title:'用户名',sortable:true,width:60},
        {field:'password',title:'密码',sortable:true,width:60},
        {field:'nickname',title:'昵称',sortable:true,width:60},
        {field:'token',title:'令牌',sortable:true,width:80,hidden:true},
        {field:'registerFrom',title:'注册From',sortable:true,width:80},
        {field:'loginFrom',title:'登录From',sortable:true,width:80},
        {field:'createdAt',title:'创建时间',sortable:true,width:80,formatter:Common.DateFormatterTime},
        {field:'lastVisit',title:'最后登录时间',sortable:true,width:80,formatter:Common.DateFormatterTime},
        {field:'avatar',title:'头像',sortable:true,width:80},
        {field:'email',title:'邮箱',sortable:true,width:80},
        {field:'phone',title:'电话',sortable:true,width:80},
        {field:'loginCount',title:'登录次数',sortable:true,width:80},
        {field:'examDate',title:'考试日期',sortable:true,width:80,formatter:Common.DateFormatterTime}
      ]]
    });

  });

  function editActivity(){
    url = '<%=basePath%>service/live/edit';
    var row = $('#tt').datagrid('getSelected');
    if (row){
    	var activityId = row.id;
    	location.href="<%=basePath %>/activityManage/toAddActivity?activityId=" + activityId;
    }else {
    	alert("请选择要修改的活动");
    }
  }
  
  function deleteActivity(){

    var row = $('#tt').datagrid('getSelected');
    if (row){
      $.messager.confirm('提示','确定要删除这个class吗？',function(r){
        if (r){
          $.post('<%=basePath%>activityManage/removeActivity',{id:row.id},function(result){
            $('#tt').datagrid('reload');    // reload the data
          },'json');
        }
      });
    }else {
    	alert("请选择要删除的数据");
    }
  }
  //查询
 function searchUser(){
	  
	 var day = $("#day").textbox("getValue");
	 var url = '<%=basePath %>service/class/sys/user?day='+day;
	 $("#tt").datagrid({
		 url:'<%=basePath %>service/class/sys/user?day='+day,
		 method:'get',
		 onLoadSuccess:function(data){
			 if(data.total == null){
				 $.messager.alert("提示","没有查询到任何符合条件的数据")
			 }
		 }
	 });
 }

</script>
</html>
